home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tegl6b.zip / INTROPAK.EXE / lha / BUTTONS.PAS < prev    next >
Pascal/Delphi Source File  |  1991-07-11  |  3KB  |  109 lines

  1. {$I switches.inc}
  2. {-------------------------------------------------------------------}
  3. { TWDEMO.PAS                                }
  4. { Copyright 1991 TEGL SYSTEMS CORPORATION, All rights reserved.     }
  5. {-------------------------------------------------------------------}
  6.  
  7.  
  8. {$F+} {-- far  call is necessary for EVENTS }
  9.  
  10. Uses
  11.   teglfont,  {-- the graphics group }
  12.   fastgrph,
  13.   tgraph,
  14.  
  15.   virtmem,   {-- memory }
  16.  
  17.   teglintr,
  18.   teglunit,  {-- window manager, menus and micellaneous }
  19.   teglmenu,
  20.   teglmain,
  21.   teglspec,
  22.  
  23.   twcommon,  {-- high-level windows }
  24.   twkernel,
  25.   twwindow,
  26.   twworld,
  27.   twdialog,
  28.   twcontrl;
  29.  
  30.  
  31. {-- Global variables }
  32.  
  33. VAR
  34.   mainmenu: ImageStkPtr;   {-- the main bar menu is only an ordinary frame}
  35.                {-- with option menu click areas placed on it. }
  36.   menufont: pointer;       {-- the font to use with all menus. Set once so }
  37.                {-- we can make the program look better on }
  38.                {-- a variety of video displays. }
  39.   fileom   : optionmptr;
  40.   dialogom : optionmptr;
  41.  
  42.  
  43. function dialogclose(ifs : ImageStkPtr; ms: MsClickPtr): Word;
  44.   begin
  45.     dialogclose := twdClose(ifs,ms);
  46.   end;
  47.  
  48. {-- Opens up a simple dialog window. }
  49.  
  50. Function OpenDialogDemo(ifs: ImageStkPtr; ms: MsClickPtr): Word;
  51.   VAR tempifs : imagestkptr;
  52.       wf      : winframeptr;
  53.       i,j     : integer;
  54.   BEGIN
  55.       for i:=1 to 5 do
  56.      begin
  57.       twdInit(wf,100,100,400,300);
  58.       twSetHeader(wf,'Simple Dialogue');
  59.       twdAddLabel(wf,10,10,'Labels go anywhere');
  60.       twdAddbutton(wf,50,150,'OK',nilunitproc);
  61.       twdAddButton(wf,180,150,'CANCEL',dialogclose);
  62.       twSetCloseEvent(wf,dialogclose);    {-- the space bar menu }
  63.       twDrawWindowFrame(wf);
  64.       end;
  65.  
  66.       twdInit(wf,50,50,600,350);
  67.       twdAddLabel(wf,10,10,'Labels go anywhere');
  68.       twdAddLabel(wf,10,10,'Labels go anywhere');
  69.       twdAddLabel(wf,10,10,'Labels go anywhere');
  70.       twdAddLabel(wf,10,10,'Labels go anywhere');
  71.       twdAddLabel(wf,10,10,'Labels go anywhere');
  72.       for i:=1 to 10 do
  73.      for j:=1 to 8 do
  74.        twdAddbutton(wf,i*44,10+j*25,'OK',nilunitproc);
  75.  
  76.       twdAddbutton(wf,10,250,'OK',dialogclose);
  77.       twSetCloseEvent(wf,dialogclose);    {-- the space bar menu }
  78.       twDrawWindowFrame(wf);
  79.   END;
  80.  
  81.  
  82. BEGIN
  83.   {-- simple start up, minimal normal heap, TWCOMMON }
  84.   twEasyStart;
  85.   setkeyboardmouse(false);
  86.  
  87.   {-- set the font to use in window headers, TWCOMMON }
  88.   twSetHeaderFont(@f8x12bol);
  89.  
  90.   menufont := @f8x12bol;   {-- set the font to use on the menu }
  91.  
  92.   FileOm    := CreateOptionMenu(MenuFont);
  93.     DefineOptions(FileOm,' E~x~it ',true,twExitOption);
  94.  
  95.   DialogOm  := CreateOptionMenu(MenuFont);
  96.     DefineOptions(DialogOm,'~M~any',True,OpenDialogDemo);
  97.  
  98.  
  99.   SetTeglFont(menufont);    {-- bar menu uses the current font }
  100.   CreateBarMenu(0,0,getmaxx);
  101.   MainMenu := StackPtr;       {-- just another frame }
  102.     OutBarOption(' ~F~ile ',     FileOm);
  103.     OutBarOption(' Dia~l~ogues ',DialogOm);
  104.  
  105.   setautorotate(true);          {-- windows rotate to the top automatically }
  106.   teglsupervisor;          {-- do not adjust your set, the supervisor }
  107.                   {-- is in control! }
  108. END.
  109.